<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<title>积分提现</title>
<link rel="stylesheet" href="<?php echo $_BASE_DIR ?>baodan/css/common.css" >
<link rel="stylesheet" href="<?php echo $_BASE_DIR ?>baodan/css/tixian.css" >
<script type="text/javascript" src="<?php echo $_BASE_DIR ?>baodan/js/jquery-3.1.1.min.js"></script>
</head>

<body>
<header class="header">
    <a class="back" href="javascript:history.back(-1)"></a>
	<div class="title">积分提现</div>
</header>
<div style="height:40px;"></div>


<div style="text-align: center;">
	<img src="<?php echo $_BASE_DIR ?>baodannew/images/avatar-img.jpg" class="user-avatar"/>
	<p class="user-name"><?php echo $user->realname ?></p>
	<p class="total-jifen">可提现积分：<?php echo $user->balance ?></p>
</div>




<div class="total above_distance1" id="div1">
		<span class="ps_1">提现金额：</span><input type="text" placeholder="请输入提现金额"  id="txt" />
</div>
 
 <div class="pay-type clearfix">
    <p class="pay-title">提现方式</p>
    <label class="demo--label">
        <input class="demo--radio" type="radio" name="demo-radio" value='wechat' checked />
        <span class="demo--radioInput"></span>微信
    </label>
    <label class="demo--label">
        <input class="demo--radio" type="radio"  value='alipay' name="demo-radio" />
        <span class="demo--radioInput"></span>支付宝
    </label>
</div>


<div class="submitxx" onclick="withdraw();">确 定</div>

<script>
function withdraw(){
	var ucheck =  $('input[name="demo-radio"]:checked');
	var ulen = ucheck.length;
  
	if(ulen == 0){
         alert('请选择收款方式');return false;
	}
	
   var paymethod = $('input[name="demo-radio"]:checked').val();
   var balance = $('#txt').val();
	
	var ajaxurl = "/my/withdraw";
	$.post(ajaxurl, {
		paymethod: paymethod,
		balance:balance,
	}, function(data){
		if(data.status == 0){
			alert(data.msg);
			location.href='/my/withdrawlog';
			return false;	
		}else{
			if(data.status == 3 || data.status == 4){
				alert(data.msg);
				location.href='/my/bindaccount';
				return false;					
			}else{
				alert(data.msg);
				return false;	
			}
		}
	}, 'json');
}
</script>

</body>
</html>
